#!/usr/bin/env python
from __future__ import print_function
import sys


def exp(flag=0):
    flags = {1: 'paired',
             2: 'each segment properly aligned',
             4: 'unmapped',
             8: 'mate unmapped',
             16: 'reverse complemented',
             32: 'mate reverse complemented',
             64: 'read1, first segment',
             128: 'read2, last segment',
             256: 'secondary',
             512: 'quality control fail',
             1024: 'dup',
             2048: 'supplementary'}

    print('%s: flag' % flag)
    for n, f in flags.items():
        if int(flag) & n == n:
            print('%s: %s' %(n, f))

exp(sys.argv[1])
